﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="Secondhand_Book_Trade.Login" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>登录 - 高校二手书平台</title>
    <style type="text/css">
            html{
                background-color: #BAF6FD;
            }
            table {
                border: 1px solid #666;        /* 边框粗细和颜色 */
                border-collapse: collapse;     /* 合并边框 */
                background-color: #fff;         /* 表格背景色 */
                margin: 20px auto;             /* 居中显示 */
            }
             .td_1{
               text-align:right;
               top:0;
           }
           .td1{
               text-align:right;
           }
    </style>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <asp:SqlDataSource ID="SqlDataSource1" runat="server"
                ConnectionString="<%$ ConnectionStrings:Secondhand_book_tradeConnectionString %>"
                SelectCommand="SELECT COUNT(*) FROM [Users] WHERE Username=@Username AND Password=@Password AND Role=@Role">
                <SelectParameters>
                    <asp:ControlParameter Name="Username" ControlID="txtUsername" PropertyName="Text" />
                    <asp:ControlParameter Name="Password" ControlID="txtPassword" PropertyName="Text" />
                    <asp:ControlParameter Name="Role" ControlID="ddlRole" PropertyName="SelectedValue" />
                </SelectParameters>
            </asp:SqlDataSource>
            <table>
                <tr>
                    <td colspan="3" align="center" style="font-size:16pt; height:40px; vertical-align:bottom;color:maroon;font-weight:bold;width:750px;">登录页面</td>
                </tr>
                <tr>
                    <td class="td_1">用户名:</td>
                    <td class="td2">
                        <asp:TextBox ID="txtUsername" runat="server" Columns="40"></asp:TextBox>
                        &nbsp;
                        <asp:RequiredFieldValidator ID="reqname" runat="server" ErrorMessage="必填" ControlToValidate="txtUsername" ForeColor="Red"></asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
                    <td class="td_1">密码：</td>
                    <td class="td2">
                        <asp:TextBox ID="txtPassword" runat="server" Columns="40" TextMode="Password"></asp:TextBox>
                        &nbsp;
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtPassword" ErrorMessage="密码不为空" ForeColor="Red"></asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
                    <td class="td1">用户角色：</td>
                    <td class="td2">
                        <asp:DropDownList ID="ddlRole" runat="server" CssClass="form-select">
                            <asp:ListItem Value="0">普通用户</asp:ListItem>
                            <asp:ListItem Value="1">卖家</asp:ListItem>
                            <asp:ListItem Value="2">管理员</asp:ListItem>
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td  class="td1">&nbsp;</td>
                    <td class="td2">
                        <div class="text-center">
                        <p>还没有账号？<a href="Register.aspx">立即注册</a></p>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td  class="td1">&nbsp;</td>
                    <td class="later">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <asp:Button ID="Button1" runat="server" Text="登录" OnClick="Button1_Click" /></td>
                </tr>
            </table>
        </div>
    </form>
</body>
</html>
